/*
 * @module:
 * @Author: 张前领<qianling.zhang@hand-china.com>
 * @Date: 2021-06-16 14:03:14
 * @LastEditTime: 2022-08-03 16:52:21
 * @copyright: Copyright (c) 2020,Hand
 */

import React, { useEffect,useRef } from "react";
import { useGLTF, useAnimations } from "@react-three/drei";

import { useSpring, animated, config } from "@react-spring/three";
export default function Model(props) {
  const { scene, materials, animations, nodes } = useGLTF(props.url);

  const { ref } = useAnimations(animations);

  const settings = useSpring({
    scale: 0.08,
    config: config.wobbly,
  });

  useEffect(() => {
    let content=Object.values(materials)[0];
    content.transparent=true;
    content.opacity=props.opacity;
    console.log(content);
  },[]);
 

  return (

    <animated.group
      ref={ref}
      {...settings}
      material={materials.glass}
      position={[0, 1, 0]}
    >
      <primitive object={scene} />
      
    </animated.group>


  );
}
